<template>
  <div id="serverCenter">
    <div class="login-head">
      <span style="color: #fff" @click="jumpFn()">
        <van-icon name="arrow-left"
      /></span>
      <span class="login-title">服务中心</span>
      <span></span>
    </div>
    <div class="service_connect">
      <a
        class="service-left"
        href="tencent://message/?uin=2631591750&Site=&Menu-=yes"
      >
        <img src="../../static/kf.png" alt="" />
        <p>在线客服</p>
      </a>
      <a class="service-right" href="tel:10105757">
        <img src="../../static/d.png" alt="" />
        <p>在线客服</p>
      </a>
    </div>
    <div class="list-content">
      <p class="hot-question">热门问题</p>
      <ul>
        <li v-for="(item, index) in list" :key="index" @click="jumpserverContent(item)">
          <span>{{ item.title }}</span>
          <span class="abc">
              <img src="../../static/rigjtJt.png" alt="">
          </span>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: "serverCenter",
  data() {
    return {
      list: [],
    };
  },
  mounted() {},
  methods: {
    jumpFn() {
      this.$router.push({
        name: "myVal",
      });
    },
    jumpserverContent(item){
    localStorage.setItem('item', JSON.stringify(item));
    console.log(item)
    this.$router.push({
        name:"serverContent"
    })
    }
  },
  created() {
    let api = "https://elm.cangdu.org/v3/profile/explain";
    this.$http({
      url: api,
      method: "get",
      withCredentials: true,
    }).then((res) => {
      console.log(res.data);
      let index = 0;
      let title = [];
      let centent = [];
      let data = [];
      delete res.data.index;
      for (let i in res.data) {
        index++;
        if (index % 2 == 0) {
          title.push(res.data[i]);
        } else {
          centent.push(res.data[i]);
        }
      }
      for (let i = 0; i < title.length; i++) {
        data.push({
          title: title[i],
          text: centent[i],
        });
      }
      console.log(data);
      this.list = data;
      console.log(this.list);
  
    });
  },
};
</script>

<style scoped>
.login-head {
  width: 100%;
  height: 46.5312px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0092e8;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
}
.login-title {
  color: white;
  position: relative;
  left: -19.9985px;
  font-size: 19.9985px;
}
.service_connect {
  display: inline-flex;
  margin-top: 50px;
}
.service_connect img {
  width: 24px;
  height: 24px;
  margin-top: 20px;
}
.list-content {
  width: 100%;
  padding: 0 15px;
  box-sizing: border-box;
  background-color: #fff;
}
.list-content li {
  width: 100%;
  font-size: 13px;
  color: #666;
  line-height: 47px;
  display: inline-flex;
  justify-content: space-between;
}
.abc img{
    width: 15px;
    height: 15px;
}
.hot-question {
  width: 100%;
  height: 71px;
  font-size: 17.5px;
  color: #333;
  line-height: 71px;
  border-bottom: 1px solid #f5f5f5;
}
.service-left {
  box-sizing: border-box;
  border-left: 1px solid #f5f5f5;
}
.service_connect a {
  width: 100%;
  height: 100%;
  text-align: center;
  display: inline-flex;
  align-items: center;
  flex-direction: column;
}
.service_connect {
  width: 100%;
  height: 94px;
  background-color: #fff;
}
.service_connect p {
  font-size: 14px;
  color: #666;
  margin-top: 10px;
}
</style>